package com.ztesoft.book.core.sys.sysuserrole.mapper;

import com.ztesoft.book.core.base.base.mapper.BaseExMapper;
import com.ztesoft.book.core.sys.sysuserrole.dto.SysUserRoleDTO;
import com.ztesoft.book.core.sys.sysuserrole.qo.SysUserRoleQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * @Description 用户与角色对应关系
 * @Author YangFan
 * @Date 2021-06-22 17:32
 */
@Mapper
public interface SysUserRoleMapper extends BaseExMapper<SysUserRoleDTO, SysUserRoleQO> {

    /**
     * 根据用户id列表获取权限列表
     *
     * @param userIdSet
     */
    List<SysUserRoleDTO> getListByUserIds(@Param("userIdSet") Set<String> userIdSet);


    void saveBatch(@Param("list") List<SysUserRoleDTO> list);

    void deleteByUserId(@Param("userId") String userId);

    /**
     * 获取权限列表
     *
     * @param userId
     * @return
     */
    List<String> getRoleIdListByUserId(@Param("userId") String userId);

    /**
     * 统计角色现有用户数
     *
     * @param roleId roleId
     * @return
     */
    int countRoleUser(@Param("roleId") String roleId);
}
